<template>
  <el-descriptions :column="1" border>
    <el-descriptions-item label="案件类型">{{ caseData.case_type }}</el-descriptions-item>
    <el-descriptions-item label="案由">{{ caseData.case_cause_name }}</el-descriptions-item>
    <el-descriptions-item label="管辖法院">{{ caseData.court_name }}</el-descriptions-item>
    <el-descriptions-item label="开庭处所/时间">
      <span>{{ caseData.session_court_name }}</span>
      <span style="margin-left: 20px">{{ formatTime(caseData.session_time, 'datetime') }}</span>
    </el-descriptions-item>
    <el-descriptions-item label="主办律师/管家">
      <span :class="{ 'empty-lawyer': !caseData.main_lawyer_name }">
        {{ caseData.main_lawyer_name || '未指定主办律师' }}
      </span>
      <span style="margin: 0 10px">/</span>
      <span :class="{ 'empty-lawyer': !caseData.secondary_lawyer_name }">
        {{ caseData.secondary_lawyer_name || '未指定管家' }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="出庭律师">
      <span :class="{ 'empty-lawyer': !caseData.session_lawyer_name }">
        {{ caseData.session_lawyer_name || '未指定出庭律师' }}
      </span>
    </el-descriptions-item>
    <el-descriptions-item label="创建时间/更新时间">
      <span>{{ formatTime(caseData.create_time, 'time') }}</span>
      <span style="margin-left: 20px">{{ formatTime(caseData.update_time, 'time') }}</span>
    </el-descriptions-item>
  </el-descriptions>
</template>

<script setup lang="ts">
  import { getCaseTypeText, getStageText, getStatusText } from '@/constants/lawcase'

  // 定义案件类型接口
  interface LawCase {
    id: number
    case_code: string
    case_cause_name?: string
    case_cause_id?: number
    court_name: string
    main_lawyer_name: string
    secondary_lawyer_name: string
    session_lawyer_name?: string
    client_info: string
    opponent_info: string
    status: string
    type: number
    stage: number
    session_court_name: string
    session_time: string
    create_time: string | number
    update_time: string | number
    entrust_date: string
    // 其他可能的字段
    [key: string]: any
  }

  const props = defineProps<{
    caseData: LawCase
    formatTime: (time: number | string, format?: 'date' | 'datetime' | 'time') => string
  }>()
</script>

<style scoped>
  .empty-lawyer {
    color: #999;
    font-style: italic;
  }
</style>
